@extends('layout.index')
@section('title','商品添加')
@section('content')
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<script type="text/javascript" charset="utf-8" src="/JS/baidu/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="/JS/baidu/ueditor.all.min.js"> </script>
<!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
<!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
<script type="text/javascript" charset="utf-8" src="/JS/baidu/lang/zh-cn/zh-cn.js"></script>
<div class="row">
    <div class="col-lg-12">
        <h1 class="page-header">商品添加</h1>
    </div>
    <!-- /.col-lg-12 -->
</div>
<div class="panel panel-default">
	<div class="panel-heading">
		<!-- @if(session('error'))
	   <div class="alert alert-danger alert-dismissable">
            <button aria-hidden="true" data-dismiss="alert" class="close" type="button">×</button>
            	{{session('error')}}
        </div>
        @endif -->
        @if (count($errors) > 0)
		    <div class="alert alert-danger">
		        <ul>
		            @foreach ($errors->all() as $error)
		                <li>{{ $error }}</li>
		            @endforeach
		        </ul>
		    </div>
		@endif
	</div>
	<div class="panel-body">
	    <div class="row">
	        <div class="col-lg-4">
	            <form role="form" action="{{url('/admin/goods/insert')}}" method="post" enctype="multipart/form-data">
	            	<div class="form-group">
	                    <label>商品分类</label>
		                    <select name="pid" class="form-control">
		                        @foreach($goods as $k=>$v)
		                            <option value="{{$v->id}}">{{$v->name}}</option>
		                        @endforeach
	                        </select>
	                    <p class="help-block"></p>
	                </div>
	                <div class="form-group">
	                    <label>商品名称</label>
	                    <input type="text" name="trade_name" value="{{old('trade_name')}}" class="form-control">
	                    <p class="help-block"></p>
	                </div>
	                <div class="form-group">
	                    <label>商品价格</label>
	                    <input type="text" name="price" value="{{old('price')}}" class="form-control">
	                    <p class="help-block"></p>
	                </div>
	                <div class="form-group">
	                    <label>商品标题</label>
	                    <input type="text" name="title" value="{{old('title')}}" class="form-control">
	                    <p class="help-block"></p>
	                </div>
	                <div class="form-group">
	                    <label>商品介绍</label>
					    <script id="editor" name="content" type="text/plain" style="width:600px;height:300px;"></script>
	                </div>
					<div class="form-group">
	                    <label>图片</label>
	                    <input type="file" name="pic">
	                </div>
	                {{csrf_field()}}
		                
	                <button type="submit" class="btn btn-primary">添加</button>
	                <button type="reset" class="btn btn-danger">重置</button>
	            </form>
	        </div>
	        <!-- /.col-lg-6 (nested) -->
	    </div>
	    <!-- /.row (nested) -->
	</div>
	<!-- /.panel-body -->
</div>
<script type="text/javascript">
    //实例化编辑器
    //建议使用工厂方法getEditor创建和引用编辑器实例，如果在某个闭包下引用该编辑器，直接调用UE.getEditor('editor')就能拿到相关的实例
    var ue = UE.getEditor('editor');
</script>
@endsection
